<template>
	<div>
		<a-card :bordered="false" style="display: flex;justify-content:left;height: 100%;">
			<div>
				<p>{{userInfo.nickName}},{{userInfo.name}}</p>
				<p>{{userInfo.email}},{{userInfo.phone}}</p>
				<p>{{userInfo.lastLoginTime}}</p>
				<p>{{userInfo.lastLoginIp}}</p>
				<p>{{userInfo.lastLoginBrowser}}</p>
				<p>{{userInfo.lastLoginOs}}</p>
			</div>
		</a-card>
		<a-card :bordered="false" style="display: flex;justify-content:center;height: 100%;margin-top:10px;">
			<div style="margin:100px auto;">
				<img src="~@/assets/welcome.png" class="logo" alt="logo">
			</div>
		</a-card>
	</div>
</template>

<script>
	import router from '@/router'
	import {
		mapGetters
	} from 'vuex'
	export default {
		components: {},
		data() {
			return {
				xjb_role_default_page: [],
			}
		},
		computed: {
			...mapGetters(['userInfo'])
		},
		created() {
			this.$nextTick(() => {
				this.xjb_role_default_page = this.$options.filters['dictData']('xjb_role_default_page')
			})
			this.$nextTick(() => {
				this.to_page()
			})
		},
		methods: {
			get_default_page(roleObj) {
				var path = null
				var code = roleObj.code
				this.xjb_role_default_page.forEach(g => {
					if (g.name == code) {
						if (path) {} else {
							path = g.code
						}

					}
				});
				return path
			},
			to_page() {
				var page_name = null
				const userInfo = this.userInfo
				console.log("userInfo", userInfo)
				var roles = userInfo.roles || []
				roles.forEach(rr => {
					var page = this.get_default_page(rr);
					if (page) {
						if (page_name) {} else {
							page_name = page
						}
					}
				})
				//console.log("page_name", page_name);
				if (page_name) {
					setTimeout(function() {
						router.push({
							path: page_name
						})
					}, 1000);

				}
			}
		}
	}
</script>

<style lang="less" scoped>

</style>
